<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateShopStaffRecords extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('shop_staff_records', function (Blueprint $table) {
            $table->id();
            $table->unsignedInteger('shopId')->default(0)->comment('门店ID');
            $table->unsignedInteger('shopCode')->default(0)->comment('门店Code'); // 要排序
            $table->unsignedInteger('userId')->default(0)->comment('用户ID');
            $table->tinyInteger('inShop')->default(0)->comment('是否需要到店  0-到店  1-不到店');
            $table->tinyInteger('auditStatus')->default(0)->comment('审核状态  0-过期/缺失 1-待审核 2-待驳回 3-已通过 4-无需到店 5-离职');
            $table->string('causeOfRejection', 255)->default('')->comment('驳回原因');
            $table->tinyInteger('healthCardStatus')->default(0)->comment('健康证状态  0-缺失 1-已上传 2-即将到期 3-已过期 4-null');
            $table->tinyInteger('idCardStatus')->default(0)->comment('身份证状态  0-缺失 1-已上传');
            $table->tinyInteger('positionStatus')->default(0)->comment('职位状态  0-在职 1-离职');
            $table->unsignedInteger('entryTime')->default(0)->comment('入职时间');
            $table->unsignedInteger('leaveTime')->default(0)->comment('离职时间');
            $table->unsignedInteger('lastAuditTime')->default(0)->comment('最近审核时间');
            $table->unsignedInteger('lastManagerUpdateTime')->default(0)->comment('商家更新时间');
            $table->unsignedInteger('createdByUid')->default(0)->comment('创建人');
            $table->unsignedInteger('updatedByUid')->default(0)->comment('更新人');
            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('updatedAt')->default(0)->comment('更新时间');
            $table->index('userId', 'idx_userId');
            $table->index('shopId', 'idx_shopId');
            $table->comment   = '门店员工备案列表';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('shop_staff_records');
    }
}
